package figure

import (
	"math"
)

type Point struct {
	x float64
	y float64
}

func calcPoints(r float64, angle float64) (ps [5]Point) {
	for i := 0; i < 5; i++ {
		a := angle - math.Pi*2/5*float64(i)
		ps[i].x = r * math.Cos(a)
		ps[i].y = r * math.Sin(a)
	}
	return
}

func starPoints(r float64) [11]Point {
	outs := calcPoints(r, math.Pi*2*270/360)
	r = r * math.Sin(math.Pi*2*18/360) / math.Cos(math.Pi*2*36/360)
	ins := calcPoints(r, math.Pi*2*234/360)
	ps := [11]Point{}
	for i := 0; i < 5; i++ {
		ps[i*2] = outs[i]
		ps[i*2+1] = ins[i]
	}
	ps[10] = ps[0]
	return ps
}
